import Vue from 'vue'
import Vuex from 'vuex'
// 引入插件
import createPersistedState from 'vuex-persistedstate'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    // 登录组件是否显示
    isShow: false,

    // 存储用户token
    token: "",
    userInfo: {}
  },
  getters: {
  },
  mutations: {
    setIsShow(state, value) {
      state.isShow = value;
    },
    setToken(state, value) {
      state.token = value;
    },
    setUserInfo(state, value) {
      state.userInfo = value;
    }
  },
  actions: {
  },
  modules: {
  },
  plugins: [createPersistedState({ storage: window.sessionStorage })]
})
